package rabbit.delay;

/**
 * @Author: admin
 * @Description:
 * @Date: 2018/7/30 20:08
 */

import com.rabbitmq.client.AMQP;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;

public class mq {
    // dF4Rfiu9wpwNGOPl338ca/Skeh6LSHsQt8HxpJ0T8vBO0ZXbDylgbrMTHD/BSxRK3jclmeDhlNN5OF2cEJ3QdNKLnqDtn8KFwmlN3jvCC+xLGfGJWCPjpI+D2v5I8f1CVUw79l3QyvzxRtw4q6ICe9g5fQOtNo4Sd2mCRosvE5s4y/pHSe8QBuGzUnMZPqo1xuv+Bu8AVmEEdEvMO/581dNT4lOI8gaQX9IDTtClIZXScUXy17MEKXxDXYKJ0I1XNGGipWzK/zhg7Nn+F3xXb3+qHXYTXW6x0cB/GB3g+3WGP5WNiQASls0ENzwlTzEYgiGIxRnki+h4rJyPXmO1A2gMyiGgfkjP6JUtLRnlV6BZwKKj6S8J4bn3xh8pcTQHi8u58e3vCXMByZPY+QMz7Q/x9MHq2xNjzYpjSQ5ZjsIpYo/o5PYGd6cGTTMuYzRovTB4f890AeUr/MZGrnNfGfHdD7EWly0Q94e3SlywrtlWs4sVltWQHD07k1yTYq8qI5cgHDoxr182Ie4QOXVvLkEbtn/MS4hktDB5Lycnoh2TzTTjOLSjpDLV7DRkEWyyQQreia7sE0NQWpheyN3PsLbCOiRCgQEppiXP3HBtdkDfLbSHUeeqERQ8bv9NHLR1fz3KvuTogq+qbAnpWRnGIF4gSJWhBbI2MIDpTkBEUfMxokViPSOEbHa3zFk5XaLeh8mfHEHcibfrdW+x/d7DjOM3JfuUFfMBcmXLbXKIR70ci5NPFW33z3y0GsbunZvRwruQKmeHWqVvI7Vu9Daq3Ai/LxWxL1+zxN16N3Dke90eleCDtJ5TmeOGjPsPoy4/G2P2vR8/1HAdJ3iuNgprLnahDURfvnDHz/PQ+L5sPRMD/2lu7ucrf3uPQVJYcdvcjdb8etegyeHcGaTeokEmyHNNmv27vw/yDNZ75+J8HsL+0036gZHx0q9Ri7HdpgqcZBtX7GTFstynCUwWIX98u5uXONLHHqbSWszInYmL5qfC15TOG878vYrgITSNdvqn
    private static final String EXCHANGE_NAME = "hiddencallbasedelayedexchange1";

    public static void main(String[] argv) {


        Connection connection = null;
        Channel channel = null;
        try {
            ConnectionFactory factory = new ConnectionFactory();
            //factory.setHost("39.106.144.161");
            //factory.setHost("192.168.0.27");
            //factory.setHost("39.106.17.245");
            factory.setHost("192.168.0.88");
            factory.setPort(5672);
            factory.setVirtualHost("OuterHost");
            factory.setUsername("root");
            factory.setPassword("root");
            connection = factory.newConnection();
            channel = connection.createChannel();

            channel.exchangeDeclare(EXCHANGE_NAME, "x-delayed-message", true);
            AMQP.BasicProperties basicProperties = new AMQP.BasicProperties.Builder().expiration("30000").deliveryMode(2).build();
            channel.basicPublish(EXCHANGE_NAME, "hiddencallbasedelayedqueue1", basicProperties,
                    "{\"appId\":\"bb637243ae9d8010b1943d924b49e0cb\",\"callId\":\"api0070001321015414972185257O6R3\",\"attempts\":3}".getBytes("UTF-8"));

        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (connection != null) {
                try {
                    connection.close();
                } catch (Exception ignore) {
                }
            }
        }
    }
}


